package com.feri.api.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class R {
    private Integer code;
    private String msg;
    private Object data;

    public static R ok(Object data){
        R r=new R();
        r.setCode(200);
        r.setMsg("OK");
        r.setData(data);
        return r;
    }
    public static R ok(){
        return ok(null);
    }
    public static R fail(String msg){
        R r=new R();
        r.setCode(400);
        r.setMsg(msg);
        r.setData(null);
        return r;
    }
    public static R fail(){
        return fail("FAIL");
    }
}
